package com.meida.boot.handler.app;


import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.IndexInterceptor;
import com.meida.module.activity.provider.service.InteActivityService;
import com.meida.module.system.provider.service.SysSliderService;
import com.meida.module.product.provider.service.ProdShopTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 周边活动首页接口
 *
 * @author zyf
 */
@Component("activityIndexHandler")
public class ActivityIndexHandler implements IndexInterceptor {

    @Autowired
    private SysSliderService sliderService;
    @Autowired
    private InteActivityService activityService;
    @Autowired
    private ProdShopTypeService typeService;

    @Override
    public EntityMap complete(EntityMap params) {
        EntityMap result = new EntityMap();
        //轮播图
        List<EntityMap> sliderList = sliderService.listBySliderType(3, 5);
        result.put("sliderList", sliderList);
        //  //周边活动
        List<EntityMap> activityList = activityService.listNearby(params, 10, false);
        result.put("activityList", activityList);

        //周边活动分类
        List<EntityMap> typeList = typeService.listByTypeCode("ProdShop");
        result.put("typeList", typeList);
        return result;

    }
}
